/**
 * 2019年3月12日 下午4:48:17  
 * richest-api  
 * @author zhaohongchao
 * @version 1.0
 * AdmartServiceImpl.java  
 */
package com.richest.api.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.richest.api.dao.AdmartMapper;
import com.richest.api.dao.DiningTableMapper;
import com.richest.api.service.IAdmartService;
import com.richest.bean.AdmartBean;
import com.richest.util.CallResults;

/**
 * 2019年3月12日 下午4:48:17 richest-api
 * 
 * @author zhaohongchao
 * @version 1.0 AdmartServiceImpl.java
 */
@Service
public class AdmartServiceImpl implements IAdmartService {
	@Autowired
	private AdmartMapper admartMapper;
	@Autowired
	private DiningTableMapper diningTableMapper;

	@Override
	public List<Map<String, Object>> selectList(Map<String, Object> params) {
		return admartMapper.selectList(params);
	}

	@Override
	public List<Map<String, Object>> search(Map<String, Object> params) {
		return admartMapper.search(params);
	}

	@Override
	public List<Map<String, Object>> searchByType(Map<String, Object> params) {
		return admartMapper.searchByType(params);
	}

	@Override
	public AdmartBean selectById(Long lAdmartId) {
		return admartMapper.selectById(lAdmartId);
	}

	@Override
	public CallResults getDiningTable(Long admartId) {
		Map<String, Object> mapResult = new HashMap<>();
		Map<String, Object> params = new HashMap<>();
		params.put("admartId", admartId);
		params.put("type", "01");
		mapResult.put("tabl", diningTableMapper.getDiningTable(params)); // 桌

		params.put("type", "02");
		mapResult.put("room", diningTableMapper.getDiningTable(params)); // 包房
		return CallResults.ok().put("data", mapResult);
	}
}
